package cn.novel.bm.controller.novel;


import cn.novel.bm.util.ResponseResult;
import cn.novel.bm.domain.novel.Chapter;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//@RequestMapping(value = "/chapter", produces = MediaType.APPLICATION_JSON_VALUE)
//@RestController
//@Api(tags = "章节管理")
public class ChapterController {

    @GetMapping(path = "/{chapterId}")
    @ApiOperation(value = "查询章节")

    public ResponseResult<Chapter> query(@PathVariable int chapterId) {
        return new ResponseResult<>();
    }


    @PostMapping(path = "/source", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiOperation(value = "编辑章节原文", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "chapterId", value = "原章Id", paramType = "formData"),
            @ApiImplicitParam(name = "sourceChapter", value = "原章节", paramType = "formData")
    })
    public ResponseResult<Void> editSource(@ApiParam(value = "原章Id", required = true) @RequestParam int chapterId,
                                            @ApiParam(value = "原章节", required = true) @RequestParam String sourceChapter) {
        return new ResponseResult<>();
    }
    @DeleteMapping(path = "/{chapterId}")
    @ApiOperation(value = "删除章节")

    public ResponseResult<Void> delete(@PathVariable int chapterId) {
        return new ResponseResult<>();
    }


    @ApiOperation(value = "查询章节列表")
    @GetMapping(path = "/findList")

    public ResponseResult<List<Chapter>> findList(@RequestParam int novelId
            , @RequestParam @ApiParam(value = "页码") int pageIndex
            , @RequestParam @ApiParam(value = "每页条数") int pageSize) {
        return new ResponseResult<>();
    }


    @ApiOperation(value = "指派外包", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @PostMapping(path = "/assignOEditor", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "chapterId", paramType = "formData"),
            @ApiImplicitParam(name = "userId", paramType = "formData"),

    })
    public ResponseResult<Void> assignOEditor(@RequestParam @ApiParam(value = "章节ID") int chapterId
            , @RequestParam @ApiParam(value = "用户名") int userId) {
        return new ResponseResult<>();
    }


}
